
/*
 * This class takes one input stream and forwards it, as is, to two output ports
 * @author Team 10
 */
public class SplitterFilter extends FilterFramework2
{
	public SplitterFilter() 
	{
		// this filter has one input and 2 outputs
		super(1, 2);
	}

	public void run()
    {
		while (true)
		{
			try
			{
				// This measurement will aid with extracting and setting specific data within
				// an entire Data Frame
				Measurement measurement = new Measurement();
				
				// read bytes from Pipe 0
				measurement.readByteStream(this, 0);

				// write the current measurement to the two output ports
				measurement.writeByteStream(this, 0);
				measurement.writeByteStream(this, 1);
				
			} // try

			catch (EndOfStreamException e)
			{
				CloseInputPorts(0);
				CloseOutputPorts(0);
				break;

			} // catch

		} // while

   } // run
}
